package com.changgou.controller;

import com.changgou.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: hushengjin
 */

@RestController
@RequestMapping("/userInfo")
@CrossOrigin
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    @PostMapping("/add")
    public String decrMoney(@RequestParam(value = "username") String username, @RequestParam(value = "money") int money) {
        boolean b = userInfoService.decrMoney(username, money);
        if (b) {
            return "success";
        }
        return "fail";
    }

}
